Filter hook 'term_links-{$taxonomy}'

in WP Core File wp-includes/category-template.php at line 1375

View Source

term_links-{$taxonomy}

Filter Hook
Description
Filters the term links for a given taxonomy. The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. Possible hook names include: - `term_links-category` - `term_links-post_tag` - `term_links-post_format`

Hook Information

File Location wp-includes/category-template.php View on GitHub
Hook Type Filter
Line Number 1375

Hook Parameters

Type Name Description
string[] $links An array of term links.

Usage Examples

Basic Usage
<?php
// Hook into term_links-{$taxonomy}
add_filter('term_links-{$taxonomy}', 'my_custom_filter', 10, 1);

function my_custom_filter($links) {
    // Your custom filtering logic here
    return $links;
}

Source Code Context

wp-includes/category-template.php:1375 - How this hook is used in WordPress core
<?php
1370  	 *
1371  	 * @since 2.5.0
1372  	 *
1373  	 * @param string[] $links An array of term links.
1374  	 */
1375  	$term_links = apply_filters( "term_links-{$taxonomy}", $links );  // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
1376  
1377  	return $before . implode( $sep, $term_links ) . $after;
1378  }
1379  
1380  /**

PHP Documentation

<?php
/**
	 * Filters the term links for a given taxonomy.
	 *
	 * The dynamic portion of the hook name, `$taxonomy`, refers
	 * to the taxonomy slug.
	 *
	 * Possible hook names include:
	 *
	 *  - `term_links-category`
	 *  - `term_links-post_tag`
	 *  - `term_links-post_format`
	 *
	 * @since 2.5.0
	 *
	 * @param string[] $links An array of term links.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/category-template.php
Related Hooks

Related hooks will be displayed here in future updates.